/*
 * =====================================================================================
 *
 *       Filename:  Digraph.h
 *
 *    Description:  Generic Digraph represented by a matrix of integers. His values [-1, 0, 1, 2] represents:
 *					-1: incident vertex;
 *					 0: incident and adjacent vertex ( a bidirectional edge );
 *					 1: adjacent vertex;
 *
 *        Version:  1.0
 *        Created:  18-08-2010 02:01:38
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Rodolfo Câmara Villordo (R.C.V.), rodolfovillordo@gmail.com
 *        Company:  
 *
 * =====================================================================================
 */

#ifndef _DIGRAPH_H
#define _DIGRAPH_H

#include<vector>
using namespace std;


/** 
 * @brief Generic Digraph represented by a matrix of integers. His values [-1, 0, 1, 2] represents:
 *					-1: incident vertex;
 *					 0: incident and adjacent vertex ( a bidirectional edge );
 *					 1: adjacent vertex;
 *					 2: no relationship
 */
class Digraph {
	private:
		/** 
		 * @brief the matrix represantation of graph
		 */
		vector< vector<int> >graph;
		/** 
		 * @brief number of vertices in the graph
		 */
		int vertices;

		Digraph( ) { }
		void initializeGraph();
	public:
		/** 
		 * @brief Constructor
		 * 
		 * @param vertices number of vertices in the graph
		 */
		Digraph( int vertices );

		virtual ~Digraph();
		/** 
		 * @brief insert an edge in graph, edge is oriented from de fromVertice parameter to the toVertice parameter
		 * 
		 * @param fromVertice a vertice in the graph ( index of the matrix ) 
		 * @param toVertice a vertice in the grapph ( index of the matrix )
		 */
		void insertEdge( int fromVertex, int toVertex );
		/** 
		 * @brief insert an bidirectional edge in graph
		 * 
		 * @param fromVertex a position in matrix
		 * @param toVertex a position in matrix
		 */
		void insertBidirectionalEdge( int fromVertex, int toVertex );
		/** 
		 * @brief delete an adge from the graph
		 * 
		 * @param fromVertex a position in matrix
		 * @param toVertex  a position in matrix
		 */
		void deleteEdge( int fromVertex, int toVertex );
		
		void print();

};

#endif
